import java.util.*;

public class C_2309 {
    public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int K = Integer.parseInt(sc.nextLine());
            int num = 0;
            String str = sc.nextLine();
            String temp;
            List<Integer> list = new ArrayList<>();
            if (str.startsWith("Alice"))
                list.add(0);
            for (int i = 0; i < str.length() - 7; i++) {
                temp = str.substring(i, i + 7);
                if (temp.equals(" Alice ") || temp.equals(".Alice ") || temp.equals(" Alice.") || temp.equals(".Alice."))
                    list.add(i + 1);
            }
            if (str.endsWith("Alice."))
                list.add(str.length() - 6);
            boolean[] b = new boolean[2000000];
            if (str.startsWith("Bob"))
                b[0] = true;
            for (int i = 0; i < str.length() - 5; i++) {
                temp = str.substring(i, i + 5);
                if (temp.equals(" Bob ") || temp.equals(".Bob ") || temp.equals(" Bob.") || temp.equals(".Bob."))
                    b[i] = true;
            }
            if (str.endsWith("Bob."))
                b[str.length() - 4] = true;

            for (int t : list) {
                for (int j = Math.max(t - K - 3, 0); j < t + K + 3; j++) {
                    if (b[j])
                        num++;
                }
            }
            System.out.println(num);

    }
}
